<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="耳标号">
              <a-input placeholder="请输入耳标号" v-model="queryParam.earMark"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
             <a @click="handleDetail(record)">详情</a>
        </span>

      </a-table>
    </div>

    <cattle-archives-modal ref="modalForm" @ok="modalFormOk"></cattle-archives-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import CattleArchivesModal from './modules/CattleArchivesModal'

  export default {
    name: 'CattleArchivesList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      CattleArchivesModal
    },
    data () {
      return {
        description: '牛只档案管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'耳标号',
            align:"center",
            dataIndex: 'earMark'
          },
          {
            title:'牧场名',
            align:"center",
            dataIndex: 'pastureName'
          },
          {
            title:'牛舍名',
            align:"center",
            dataIndex: 'cowshedName'
          },
          {
            title:'性别',
            align:"center",
            dataIndex: 'sex_dictText'
          },
          {
            title:'出生日期',
            align:"center",
            dataIndex: 'birthDate',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'当前胎次',
            align:"center",
            dataIndex: 'currentParity'
          },
          {
            title:'品种',
            align:"center",
            dataIndex: 'variety_dictText'
          },
          {
            title:'养殖种类',
            align:"center",
            dataIndex: 'culturedSpecies_dictText'
          },
          {
            title:'繁殖状态',
            align:"center",
            dataIndex: 'breedStatus_dictText'
          },
          {
            title:'生长状态',
            align:"center",
            dataIndex: 'growthStatus_dictText'
          },

          {
            title:'来源耳号',
            align:"center",
            dataIndex: 'fromEarMark'
          },
          {
            title:'出生体重',
            align:"center",
            dataIndex: 'birthWeight'
          },

          {
            title:'进场金额',
            align:"center",
            dataIndex: 'entryAmount'
          },

          {
            title:'进场单号',
            align:"center",
            dataIndex: 'entryNumber'
          },

          {
            title:'创建人',
            align:"center",
            dataIndex: 'createBy'
          },
          {
            title:'创建日期',
            align:"center",
            dataIndex: 'createTime'
          },
          {
            title:'更新人',
            align:"center",
            dataIndex: 'updateBy'
          },
          {
            title:'更新日期',
            align:"center",
            dataIndex: 'updateTime'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/archives/cattleArchives/list",
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'earMark',text:'耳标号',dictCode:''})
        fieldList.push({type:'string',value:'pastureName',text:'牧场名',dictCode:''})
        fieldList.push({type:'string',value:'cowshedName',text:'牛舍名',dictCode:''})
        fieldList.push({type:'string',value:'sex',text:'性别',dictCode:'cattle_sex'})
        fieldList.push({type:'date',value:'birthDate',text:'出生日期'})
        fieldList.push({type:'int',value:'currentParity',text:'当前胎次'})
        fieldList.push({type:'string',value:'variety',text:'品种',dictCode:'cattle_variety'})
        fieldList.push({type:'string',value:'color',text:'花色',dictCode:'cattle_color'})
        fieldList.push({type:'string',value:'culturedSpecies',text:'养殖种类',dictCode:'cattle_species'})
        fieldList.push({type:'string',value:'breedStatus',text:'繁殖状态',dictCode:'cattle_breed_status'})
        fieldList.push({type:'string',value:'growthStatus',text:'生长状态',dictCode:'cattle_growth_status'})
        fieldList.push({type:'string',value:'fromEarMark',text:'来源耳号'})
        fieldList.push({type:'double',value:'birthWeight',text:'出生体重',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'entryAmount',text:'进场金额'})
        fieldList.push({type:'string',value:'entryNumber',text:'进场单号'})
        fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''})
        fieldList.push({type:'datetime',value:'createTime',text:'创建日期'})
        fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''})
        fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  /*@import '~@assets/less/common.less';*/
</style>